<?php
	class followModel extends Model{
		public function followdataAction(){
			$uid = $_SESSION['user']['id'];
			//查询语句
				$check = "SELECT u.id,u.username,u.avatar,u.remarks FROM `user` u WHERE id in(SELECT followed from `attention` where attention=$uid)";
			//查询过程
				$data = $this->link->selectDB($check);
				echo json_encode($data);
		}
		public function delfollowAction(){
			$uid = $_SESSION['user']['id'];
			$delfollowid = $_GET['delfollowid'];
			//查询语句
				$check = "DELETE FROM attention WHERE attention = $uid AND followed = $delfollowid";
			//查询过程
				$result = $this->link->query($check);
				
				if($result){
					echo json_encode(['i'=>'取消关注','msg'=>'200']);
				}else{
					echo json_encode(['i'=>'未知原因','msg'=>'201']);
				}
				
		}
	}
	
?>